package com.squirrel.serialportcore.entity.model;

/**
 * 队列配置类
 *
 * @author Squbi
 * @date 2021/3/16 17:00
 */
public class QueueModel {

    /**
     * durable:是否持久化,默认是false,持久化队列：会被存储在磁盘上，当消息代理重启时仍然存在，暂存队列：当前连接有效
     * exclusive:默认也是false，只能被当前创建的连接使用，而且当连接关闭后队列即被删除。此参考优先级高于durable
     * autoDelete:是否自动删除，当没有生产者或者消费者使用此队列，该队列会自动删除。
     * return new Queue("TestDirectQueue",true,false,false);
     * 包为org.springframework.amqp.core.
     * 一般设置一下队列的持久化就好,其余两个就是默认false
     *
     * @author Squbi
     * @date 2021/3/16 17:01
     */
    private String queueName;
    private boolean durable = false;
    private boolean exclusive = false;
    private boolean autoDelete = false;

    public QueueModel(String queueName) {
        this.queueName = queueName;
    }

    public QueueModel(String queueName, boolean durable) {
        this.queueName = queueName;
        this.durable = durable;
    }

    public QueueModel(String queueName, boolean durable, boolean exclusive) {
        this.queueName = queueName;
        this.durable = durable;
        this.exclusive = exclusive;
    }

    public QueueModel(String queueName, boolean durable, boolean exclusive, boolean autoDelete) {
        this.queueName = queueName;
        this.durable = durable;
        this.exclusive = exclusive;
        this.autoDelete = autoDelete;
    }

    public String getQueueName() {
        return queueName;
    }

    public QueueModel setQueueName(String queueName) {
        this.queueName = queueName;
        return this;
    }

    public boolean isDurable() {
        return durable;
    }

    public QueueModel setDurable(boolean durable) {
        this.durable = durable;
        return this;
    }

    public boolean isExclusive() {
        return exclusive;
    }

    public QueueModel setExclusive(boolean exclusive) {
        this.exclusive = exclusive;
        return this;
    }

    public boolean isAutoDelete() {
        return autoDelete;
    }

    public QueueModel setAutoDelete(boolean autoDelete) {
        this.autoDelete = autoDelete;
        return this;
    }
}
